// $Id: jabber.h 4 2008-09-08 18:17:41Z longerdev $

/*
Copyright (C) 2008 Longer <longerdev@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef JABBER_H
#define JABBER_H

#include <gloox/client.h> 
#include <gloox/messagehandler.h>
#include <gloox/connectionlistener.h>
#include <gloox/disco.h>
#include <iostream>

using namespace gloox;
using namespace std;

class JabCon : public MessageHandler, ConnectionListener{
	public:
		int isExit;

		JabCon();

		void JConnect();
		void setServer(const std::string server);
		void setPort(const int sPort);
		void setAuthData(const std::string sLogin, const std::string sPass);
		void setJIDs(const std::string sMyJID, const std::string sDestJID);
	private:
		Client* j;

		std::string serv;
		int port;
		std::string login;
		std::string pass;
		std::string myjid;
		std::string destjid;

		void handleMessage(Stanza* stanza, MessageSession* session = 0);
		void onConnect();
		bool onTLSConnect(const CertInfo &cinfo);
		void onDisconnect(ConnectionError e);
};

#endif

